{extend name="common@create" /}

{block name="form"}
    <div class="layui-form-item">
      <button type="button" class="layui-btn" id="upload">
        <i class="layui-icon">&#xe67c;</i>上传文件
      </button>
    </div>
    <form class="layui-form layui-form-pane" lay-filter="myform">
          <div class="layui-form-item">
              <label for="url" class="layui-form-label">
                  <span class="x-red">*</span>文件路径
              </label>
              <div class="layui-input-block">
                  <input type="text" id="url" name="url" lay-verify="required"
                  autocomplete="off" class="layui-input " value="{$list.data.url|default=''}" placeholder="中文2-25个字符" disabled="true">
              </div>
          </div>
          <div class="layui-form-item" style="text-align: right;">
              <button  class="layui-btn" lay-filter="mysubmit" lay-submit="">
                  {$list.set.butname}
              </button>
          </div>
      </form>
{/block}

{block name="myjs"}
<script>

layui.use('upload', function(){
  var upload = layui.upload;
   
  //执行实例
  var uploadInst = upload.render({
    elem: '#upload' //绑定元素
    ,url: "{:url('upload')}" //上传接口
    ,done: function(res){
      if(res.val == 1){
        $('#url').val(res.url);
      }
      layer.msg(res.msg);
    }
    ,data: {
      text: '考试成绩'
      ,serurl:'chengji\\'

    }
    ,acceptMime:'.xls,.xlsx'
    ,exts:'xls|xlsx'
    ,auto:true
    ,error: function(){
      //请求异常回调
    }
  });
});

</script>
{/block}

